
import java.util.Scanner;

public class UserService {
    //User user;
    public User register () throws MyException {//注册
        Scanner sc = new Scanner(System.in);

           System.out.println("请输入用户名：");
           String str1 = sc.nextLine();
           if(str1.length() <= 4 ||str1.length() >=16) {
             throw new MyException("用户名长度不符合要求");
           }

        System.out.println("请输入密码：");
        String str2 = sc.nextLine();
        if(str2.length() <= 4 ||str2.length() >=16) {
            throw new MyException("密码长度不符合要求");
        }
        System.out.println("注册成功！");
           return new User(str1,str2);
       }

}
